package com.hyt.it.ogt.kq.common.gov.enums.admission.variable;

import com.hyt.it.ogt.kq.common.gov.constant.admission.AdmissionTicketTemplateCode;

import java.util.Arrays;
import java.util.Objects;

/**
 * 自定义模板虚拟考场可选择的配置
 *
 * @author zhoumiao
 * @since 2023/2/7 15:56
 **/
public enum CustomTemplateVirtualSelectableConfigEnum {
    NONE(null, "未知", 0),

    // 考生公共的
    EXAM_NAME(AdmissionTicketTemplateCode.EXAM_NAME, "考试名称", 8),
    EXAM_URL(AdmissionTicketTemplateCode.EXAM_URL, "考试地址", 5),

    // 考生私有的
    TIME_NAME(AdmissionTicketTemplateCode.TIME_NAME, "批次名称", 1),
    SUBJECT_NAME(AdmissionTicketTemplateCode.SUBJECT_NAME, "科目名称", 2),
    TIME_START(AdmissionTicketTemplateCode.TIME_START, "批次开始时间", 3),
    TIME_END(AdmissionTicketTemplateCode.TIME_END, "批次结束时间", 4),
    EXAM_ID(AdmissionTicketTemplateCode.EXAM_ID, "考试id", 6),
    ADMISSION_NO(AdmissionTicketTemplateCode.ADMISSION_NO, "准考证号", 7),
    EXAM_PLACE(AdmissionTicketTemplateCode.PLACE_NAME, "考点", 9),
    EXAM_ROOM(AdmissionTicketTemplateCode.ROOM_NAME, "考场", 10),
    EXAM_SEAT(AdmissionTicketTemplateCode.EXAM_SEAT, "座位号", 11),
    EXAM_START(AdmissionTicketTemplateCode.EXAM_START, "考试开始时间", 12),
    EXAM_TIME(AdmissionTicketTemplateCode.EXAM_TIME, "考试时间", 13),
    PLACE_ADDRESS(AdmissionTicketTemplateCode.PLACE_ADDRESS, "考点地址", 14),
    ROOM_ADDRESS(AdmissionTicketTemplateCode.ROOM_ADDRESS, "考场地址", 15),
    ;
    private String code;
    private String text;
    private Integer sort;

    CustomTemplateVirtualSelectableConfigEnum(String code, String text, int sort) {
        this.code = code;
        this.text = text;
        this.sort = sort;
    }

    public String getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public Integer getSort() {
        return sort;
    }

    public static CustomTemplateVirtualSelectableConfigEnum get(String code) {
        return Arrays.stream(values()).filter(customTemplateVirtualSelectableConfigEnum -> Objects.equals(code, customTemplateVirtualSelectableConfigEnum.code)).findFirst().orElseGet(() -> CustomTemplateVirtualSelectableConfigEnum.NONE);
    }

    public static boolean isGovPublicInfo(String code) {
        return EXAM_NAME.getCode().equals(code)
                || EXAM_URL.getCode().equals(code)
                ;
    }
}
